%pylab inline
import matplotlib.pyplot as plt
from ipywidgets import *
Relativistic Doppler shift for the longitudinal case, with source and receiver moving directly towards or away from each other.
where $\omega_s, \omega_r$ are the frequencies of the source and the reciever, respectively.
def Doppler_shift(om,V,mu):
th=-V
ch=1/sqrt(1-th**2)
sh=th*ch
z=ch-1-sqrt(1-mu**2/om**2)*sh ## redshift z
return(z)
Doppler_shift(17,0.8,0.)
V = 0.8
mu = 0.2
ommin,ommax = [1.05*mu,2]
omvec=linspace(ommin,ommax,100)
figsize(12,8)
mu = 0.
plot(omvec,Doppler_shift(omvec,V,mu),'b',label=r'$\mu= $'+str(mu))
mu = 0.1
plot(omvec,Doppler_shift(omvec,V,mu),'r',label=r'$\mu= $'+str(mu))
mu = 0.2
plot(omvec,Doppler_shift(omvec,V,mu),'g',label=r'$\mu= $'+str(mu))
title('Redshift, vöröseltolódás, V= '+ str(V), fontsize=20)
xlabel(r'$\omega_r$',fontsize=20)
ylabel(r'$z=\frac{\omega_s-\omega_r}{\omega_r}$',fontsize=20, rotation=0, labelpad=50)
#ylabel('R (%)',rotation=0,fontsize=16, labelpad=30)
legend(loc='upper right',fontsize = 15)
axis('tight')
grid();